/**
 * ReportGear(2011)
 */
package com.reportgear.report.model.cell.value.salary;

import org.dom4j.Element;

import com.reportgear.report.model.cell.value.AbstractCellObject;
import com.reportgear.report.model.cell.value.ModelDesignableValueObjectClassManager;
import com.reportgear.report.model.cell.value.support.CommonObject;

/**
 * 
 * 薪酬主要信息，部门或成本中心,实际对象
 * 
 * @version 1.0 2011-4-5
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ReportGear 1.0
 */
public class SalaryMainObject extends AbstractCellObject {
	private CommonObject smo;

	public SalaryMainObject() {
		this.smo = new CommonObject();
	}

	public SalaryMainObject(CommonObject commObj) {
		this.smo = commObj;
	}

	public String toString() {
		return this.smo.getName();
	}

	public CommonObject getObject() {
		return smo;
	}

	@Override
	public void read(Element parent) {
		this.smo.read(parent.element("smo"));
	}

	@Override
	public void write(Element parent) {
		parent.addAttribute("class", ModelDesignableValueObjectClassManager.INSTANCE.getClassKey(this.getClass()));

		Element el = parent.addElement("smo");
		this.smo.write(el);
	}
}
